package cn.csc.module.search.dal.dataobject.skuStock;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigInteger;
import java.time.LocalDateTime;

/**
 * 库存信息 DO
 *
 * @author liuchuang
 */
@Setter
@Getter
@ToString
@Document(indexName = "sku_stock_index")
public class SkuStockDO {

    /**
     * sku库存id
     */
    @Id
    private BigInteger id;
    /**
     * SKU ID
     */
    @Field(name = "sku_id", type = FieldType.Long)
    private BigInteger skuId;
    /**
     * 实际库存
     */
    @Field(name = "actual_stock", type = FieldType.Long)
    private Integer actualStock;
    /**
     * 锁定库存
     */
    @Field(name = "lock_stock", type = FieldType.Long)
    private Integer lockStock;
    /**
     * 可售卖库存
     */
    @Field(type = FieldType.Long)
    private Integer stock;

    @Field(type = FieldType.Keyword)
    private String creator;

    @Field(name = "create_time", type = FieldType.Date, format = DateFormat.date_time_no_millis)
    private LocalDateTime createTime;

    @Field(type = FieldType.Keyword)
    private String updater;

    @Field(name = "update_time", type = FieldType.Date, format = DateFormat.date_time_no_millis)
    private LocalDateTime updateTime;


    @Field(name = "tenant_id", type = FieldType.Long)
    private BigInteger tenantId;

}
